<!--/**
 * Plugin Name: 论坛展示型app
 * Description: uloug.com To develop and share! Please keep the copyright information!
 * Author: 拾讯网
 * Author URI: http://www.uloug.com
 * Version: 1.0
 * Plugin URI: https://git.oschina.net/858598758/apicloud.mao10.app.demo.git
 * License: GPL2+
 */-->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>title</title>
		<link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
		<style>
			html {
				font-family: STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif;
			}
			.aui-card.aui-noborder > ul > li > span {
				margin-left: 80px;
				color: #FF6C00;
				font-weight: 700;
			}
			.aui-card.aui-noborder > ul > li > i {
				color: #887C7C;
				float: right;
				position: absolute;
				margin: -7px 0 0 50px;
			}
			.aui-card.aui-noborder > ul > li:active {
				background-color: #F1C40F;
			}
		</style>
	</head>
	<body>
		<div style=" padding-top: 60px;"></div>
		<div class="aui-content">
			<div class="aui-card aui-noborder">
				<ul class="aui-list-view">
					<li class="aui-list-view-cell" data-win="list_arrow">
						总占用空间<span id="total_che" style="    margin-left: 64px;">0.0M</span>
					</li>
				</ul>
			</div>
		</div>
		<div class="aui-content">
			<div class="aui-card aui-noborder">
				<ul class="aui-list-view">
					<li class="aui-list-view-cell" data-win="list_thumb" tapmode onclick="clearCache()">
						下载占用<span id="download_che">0.0M</span>
					</li>
					<li class="aui-list-view-cell" data-win="list-image" tapmode onclick="clearCache()">
						缓存占用<span id="browse_che">0.0M</span><i class="aui-iconfont aui-icon-deletefill"></i>
					</li>
				</ul>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript">
		apiready = function() {
			//获取浏览缓存大小
			getCacheSize();
			//填充数据
			cache();
		}
		function getCacheSize() {
			api.getCacheSize(function(ret) {
				var size = ret.size;
				cache(size);
			});
		}

		function cache(size) {
			var capa = 1048576;
			var browse = size / capa;
			var download = 0;
			var total = size / capa;
			var browse_che = browse.toFixed(2) + 'M';
			var download_che = download.toFixed(2) + 'M';
			var total_che = total.toFixed(2) + 'M';
			//填充数据
			$api.html($api.byId('browse_che'), browse_che);
			$api.html($api.byId('download_che'), download_che);
			$api.html($api.byId('total_che'), total_che);
			//
			$api.html($api.byId('size_che'), size);
		}
		//清理缓存
		function clearCache() {
			api.clearCache(function() {
				api.toast({
					msg : '清除完成',
				});
				self.location.reload();
			});
			
		}
	</script>
</html>